package com.moody.hibernate.domain;

import java.text.DecimalFormat;


/**
 * ReportData entity. @author MyEclipse Persistence Tools
 */

public class ReportData implements java.io.Serializable {

	// Fields

	private ReportDataId id;
	private String displayName;
	private String reportItemNo;
	private Double itemValue;
	private String displayFlag;
	private String itemValueString;
	
	//标记暂存
	public static final String TEMPSAVE = "0";
	public static final String SAVE = "1";

	// Constructors

	/** default constructor */
	public ReportData() {
	}

	/** minimal constructor */
	public ReportData(ReportDataId id) {
		this.id = id;
	}

	/** full constructor */
	public ReportData(ReportDataId id, String displayName, String reportItemNo,
			Double itemValue, String displayFlag) {
		this.id = id;
		this.displayName = displayName;
		this.reportItemNo = reportItemNo;
		this.itemValue = itemValue;
		this.displayFlag = displayFlag;
		setItemValue(itemValue);
		this.itemValueString = this.getItemValueString();
	}

	// Property accessors

	public ReportDataId getId() {
		return this.id;
	}

	public void setId(ReportDataId id) {
		this.id = id;
	}

	public String getDisplayName() {
		return this.displayName;
	}

	public void setDisplayName(String displayName) {
		this.displayName = displayName;
	}

	public String getReportItemNo() {
		return this.reportItemNo;
	}

	public void setReportItemNo(String reportItemNo) {
		this.reportItemNo = reportItemNo;
	}

	public Double getItemValue() {
		return this.itemValue;
	}

	public void setItemValue(Double itemValue) {
		this.itemValue = itemValue;
		DecimalFormat df = new DecimalFormat("###,##0.00");
		String itemValueString = null ;
		if(itemValue!=null){
			itemValueString = String.valueOf(df.format(itemValue));
			//itemValueString = itemValueString.replaceAll(",","");  
			
		}
		this.itemValueString = itemValueString;
	}

	public String getDisplayFlag() {
		return this.displayFlag;
	}

	public void setDisplayFlag(String displayFlag) {
		this.displayFlag = displayFlag;
	}

	public String getItemValueString() {
		return itemValueString;
	}

	public void setItemValueString(String itemValueString) {
		this.itemValueString = itemValueString;
		if(itemValueString != null)
			itemValueString = itemValueString.replaceAll(",","");  
			this.itemValue = Double.valueOf(itemValueString);
	}
}